<template>
	<view>
		<block v-for="(item,index) in pics" :key="index">
			<!-- <navigator v-if="item.link_url" :url="item.link_url">
				<image :src="item.pic_url" :style="{'width':item.width,'top':item.top,'height':item.height,'left':item.left}" class="inner"></image>
			</navigator> -->
			<image :src="item.img" @click="clickAd(item.page)"   class="inner"></image>
		</block>

	</view>
</template>

<script>
	import {
		userInfo
	} from "@/common/loadUserInfo.js"
	export default {
		props: {
			imgStyle: {
				type: Number,
				default: 1
			},
			imgs: Array
		},
		data() {
			return {
				userDetail: uni.getStorageSync('userDetail'),
				pics: []
			};
		},
		mounted() {
			this.pics = this.imgs
			this.loadData()
		},
		computed: {
			
		},
		methods: {
			async loadData() {
				let that = this
				that.$Request.request('/api/goods/getIndexInfo', 'GET', {}).then(res => {
					// console.log(res)
					if (res.status == 1) {
						that.indexData = res.data
					}
				}).catch(err => {
					console.log(err)
				})
				// let carouselList = await this.$api.json('carouselList');
				// this.titleNViewBackground = carouselList[0].background;
				// this.swiperLength = carouselList.length;
				// this.carouselList = carouselList;
			
				// let goodsList = await this.$api.json('goodsList');
				// this.goodsList = goodsList || [];
			},
			checkJus() {
				if (this.userDetail.is_vip == 0) {
					this.$api.msg('努力成为会员，劲享会员权益！')
					return
				}
			},
			clickAd(url) {
				// // #ifdef MP
				// if (index == 0) {
				// 	uni.navigateTo({
				// 		url: "../../district/giftPackage/giftPackage"
				// 	})
				// }
				// // #endif

				let hasToken = uni.getStorageSync('userInfo') ? true : false
				if (!hasToken) {
					uni.navigateTo({
						url: '/pages/public/login'
					})
					return
				}
				uni.navigateTo({
					url: url
				})
				// if (index == 1 || index == 3) {
				// 	if (!this.userDetail) {
				// 		let that = this
				// 		userInfo({
				// 			success: (res) => {
				// 				console.log(res.data)
				// 				that.userDetail = res.data.userinfo
				// 				uni.setStorageSync('userDetail', that.userDetail)
				// 				if(that.userDetail.is_vip==0){
				// 					that.$api.msg('努力成为会员，劲享会员权益！')
				// 					return
				// 				}else{
				// 					if (item.link_url) {
				// 						uni.navigateTo({
				// 							url: item.link_url
				// 						})
				// 					}
				// 				}
				// 			},
				// 			fail: (err) => {
				// 				console.log(err)
				// 			}
				// 		})
				// 	}else{
				// 		if(this.userDetail.is_vip==0){
				// 			this.$api.msg('努力成为会员，劲享会员权益！')
				// 			return
				// 		}else{
				// 			if (item.link_url) {
				// 				uni.navigateTo({
				// 					url: item.link_url
				// 				})
				// 			}
				// 		}
				// 	}

				// }else{
				// 	if (item.link_url) {
				// 		uni.navigateTo({
				// 			url: item.link_url
				// 		})
				// 	}
				// }

			}
		}
	}
</script>

<style lang="scss">
	.app-one-image {
		width: 750rpx
	}

	.app-three-hundred-and-sixty {
		width: 100%;
		height: 100%;
		display: -webkit-box;
		display: -webkit-flex;
		display: flex;
		-webkit-flex-wrap: wrap;
		flex-wrap: wrap;
		-webkit-box-pack: justify;
		-webkit-justify-content: space-between;
		justify-content: space-between;
	}

	.app-two-hundred-and-forty {
		width: 750rpx;
		height: 240rpx;
		position: relative
	}

	.app-one-hundred-eighty-six {
		width: 750rpx;
		position: relative;
		height: 187rpx
	}

	.app-three-hundred-seventy-two {
		width: 750rpx;
		height: 372rpx;
		position: relative
	}

	.app-customize {
		width: 750rpx;
		position: relative
	}

	.inner {
		// position: absolute;
		width: 50%;
		height: 180upx;
	}
</style>
